import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const getDirname = (metaUrl) => path.dirname(fileURLToPath(new URL(metaUrl)));

const currentDir = getDirname(import.meta.url);

const fileName = 'view'

const sourceFile = path.resolve(currentDir, `../${fileName}.zip`);
const fileData = fs.readFileSync(sourceFile);
const base64 = `data:image/png;base64,${fileData.toString('base64')}`;
fs.writeFileSync(path.resolve(currentDir, `../${fileName}.txt`), base64);
